# -*- coding: utf-8 -*-
"""
Created on Wed Jan  5 15:16:05 2022

@author: saw
"""

import imageio
import os
def generate_gif(image_paths, gif_path, duration=0.35):
    frames = []
    for image_path in image_paths:
        frames.append(imageio.imread(image_path))
    imageio.mimsave(gif_path, frames, 'GIF', duration=duration)
def main():
    image_folder = "step4image_demo"
    gif_path = "Radar_Astar2.gif"

    image_paths = []
    files = os.listdir(image_folder)
    for file in files:
        image_path = os.path.join(image_folder, file)
        image_paths.append(image_path)

    duration = 0.05
    generate_gif(image_paths, gif_path, duration)
if __name__ == "__main__":
    main()
